{{ define "pages/kubeconfig" }}
  <div class="container">
    <div class="row">
      <div class="col-md-8 offset-md-2 col-lg-6 offset-lg-3">
        {{ if eq .ConfigErr nil }}
          <h2 class="text-center my-3">Your kubeconfig is valid!</h2>
          <p class="text-center my-3">Glasskube will use the <code>{{ .Ctx.CurrentContext }}</code> context.</p>

          {{ if not .DefaultKubeconfigExists }}
            <p class="text-center my-3">
              If you want, Glasskube can save this config as your default kubeconfig for your computer. That means, that
              other kubernetes commands you might want to use (like <code>kubectl</code>) will also use this kubeconfig
              file.
            </p>
            <form class="d-flex flex-column gap-1 align-items-center" method="post" action="/kubeconfig/persist">
              <button type="submit" class="btn btn-accent">Save as default kubeconfig</button>
              <a class="btn btn-primary" href="/">Use for this session only</a>
            </form>
          {{ else }}
            <p class="text-center my-3">
              Since a file already exists at the location of your default kubeconfig, Glasskube can not save this config
              as your default. If you want to do it manually, you can move the file to this location on your computer:
              <code>{{ .KubeconfigDefaultLocation }}</code>
            </p>
            <div class="d-flex flex-column gap-1 align-items-center">
              <a class="btn btn-primary" href="/">Use for this session</a>
            </div>
          {{ end }}
        {{ else }}
          <h2 class="text-center my-3">Oh no&hellip;</h2>
          <div class="alert alert-danger my-3">
            Glasskube was not able to parse your selected kubeconfig file:
            <div class="font-monospace">{{ .ConfigErr }}</div>
          </div>
          <div class="text-center">
            <a href="/support" class="btn btn-primary">Go back</a>
          </div>
        {{ end }}
      </div>
    </div>
  </div>
{{ end }}
